package com.hifar.test.oaApi.common;

import java.beans.Transient;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@XmlRootElement
public class ApiResponse {

	private String errorCode;
	private String msg;

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getResult() {
		return isSuccess() ? "ok" : "error";
	}

	@Transient
	@XmlTransient
	public boolean isSuccess() {
		return errorCode == null || "".equals(errorCode);
	}
}
